﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PPIDesktopClient.Logic;
using PPIDesktopClient.General;

namespace PPIDesktopClient.Entities
{
    public class EUtility_QueryAssetShown : EUtility_QueryAsset
    {
        public bool IsBusy { get; set; }
        public bool IsShown { get; set; }
        public List<EUtility_Asset_XMissionStructure> Assets { get; set; }

        public EUtility_QueryAssetShown(int queryAssetID)
        {
            Utility_QueryAssetId = queryAssetID;
            IsBusy = false;
            IsShown = false;
        }
        public EUtility_QueryAssetShown(int queryAssetID, string color, EUtility_QueryAssetTextShow  text)
        :this(queryAssetID)
        {
            Color = color;
            TextToShow = text;
        }

        public void LoadAssets()
        {
            Assets = LUtility_Asset_XMissionStructure.GetServerVisits(Utility_QueryAssetId);
        }

        public static void RemoveByQueryAssetId(List<EUtility_QueryAssetShown> queryShown, int queryAssetID)
        {
            foreach (EUtility_QueryAssetShown q in queryShown)
            {
                if (q.Utility_QueryAssetId == queryAssetID)
                {
                    queryShown.Remove(q);
                    break;
                }
            }
        }

        public static void Add(List<EUtility_QueryAssetShown> queryShown, int queryAssetID)
        {
            queryShown.Add(new EUtility_QueryAssetShown(queryAssetID,"Red", EUtility_QueryAssetTextShow.Internal_Utility_ID));
        }
        public static void Add(List<EUtility_QueryAssetShown> queryShown, int queryAssetID, string color, EUtility_QueryAssetTextShow title)
        {
            queryShown.Add(new EUtility_QueryAssetShown(queryAssetID, color, title));
        }
    }
}
